Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17664

Display the correct page content in the pagination

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 3.3.17
    • Viewing forums
    • phpBB 3.3.17
      php 8.5.7
      MySQL(i) 8.0.36

      If the starting value for pagination is changed in the URL, the correct content of the displayed page is not always shown.

      If the 'start' value is set to 2, page 1 is displayed in the pagination. A portion of page 1 and page 2 is displayed in the list.
      My modified 'validate_start()' function for 'pagination.php' ensures that the content of the displayed page is always shown.

       

          public function validate_start(int $start, int $per_page, int $num_items): int
          {
              $start = $start >= $num_items ? $num_items - 1 : $start;
              $start = intdiv($start, $per_page) * $per_page;
              $start = max(0, $start);
              return $start;
          } 

       

       

            Unassigned Unassigned
            IMC_Ger IMC_Ger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: