- labels: --> source code
- summary: print_page_navigation_bar --> print_page_navigation_bar (0.95)
From
https://sourceforge.net/forum/message.php?msg_id=3241959
By: Matt Brash - mattbrash
Gallery page numbers
2005-07-11 03:16
File: view_func.php
Method: print_page_navigation_bar
Maybe it's just my gallery site (I've made some code
edits) but there seems to be an issue with page numbers
within a gallery.
When viewing gallery thumbnails, if the number of
images in the entire gallery is a multiple of the
images_per_page value then you end up with one too many
pages.
Example:
Gallery "Foo" has 80 images and there are 20 images per
page (say 4 per row and there are 5 rows). In this case
"$last" should have a value of 3 because there are
supposed to be 4 pages and the page numbers start at 0.
However, $last becomes 4 because 80/20 = 4. So, we
should be subtracting 1 from $gid_info['num_images']
instead of adding 1.
Current:
$last=(int)(($gid_info['num_images']+1)/$img_per_page);
Suggested:
$last=(int)(($gid_info['num_images']-1)/$img_per_page);
But like I said - this could just be me. I had made
some code changes, saw that the new 0.95 version was
out, upgraded, and then had a WHOLE BUNCH of problems
and had to make some code edits again... so I'm not
100% sure this wasn't my own error.
I also noticed something worth changing in
print_navigation_bar but I'll make a new comment post
for that.