bugfix: pagination bar has an empty page at the end
authorMichael Hafen <mdhafen@tech.washk12.org>
Wed, 30 Sep 2009 21:33:05 +0000 (15:33 -0600)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 1 Oct 2009 08:28:44 +0000 (10:28 +0200)
There are a few pages where the pagination_bar() call produces an empty page
when the number of results is a multiple of the results per page.  Looking at
getnbpages() I see the right way to do it.  So I changed these few pages to
either use getnbpages() or calculate the number of pages the same way.

authorities/authorities-home.pl
labels/pcard-member-search.pl
members/member.pl

index d80acc4..1eb58b0 100755 (executable)
@@ -125,7 +125,7 @@ if ( $op eq "do_search" ) {
 
     $template->param(
         pagination_bar => pagination_bar(
-            $base_url,  int( $total / $resultsperpage ) + 1,
+            $base_url,  getnbpages( $total, $resultsperpage ),
             $startfrom, 'startfrom'
         ),
         total     => $total,
index 1ff5cf1..3842bd0 100755 (executable)
@@ -141,7 +141,7 @@ my $base_url =
 
 $template->param(
     paginationbar => pagination_bar(
-        $base_url,  int( $count / $resultsperpage ) + 1,
+        $base_url,  int( ($count - 1) / $resultsperpage ) + 1,
         $startfrom, 'startfrom'
     ),
     startfrom => $startfrom,
index 6d42b45..13daa0d 100755 (executable)
@@ -138,7 +138,7 @@ my $base_url =
 
 $template->param(
     paginationbar => pagination_bar(
-        $base_url,  int( $count / $resultsperpage ) + 1,
+        $base_url,  int( ($count - 1) / $resultsperpage ) + 1,
         $startfrom, 'startfrom'
     ),
     startfrom => $startfrom,