Topic: Small update in pagination

Currently, if you go to a page that is higher than the current amount of pages (eg. 99), you get sent to page 1.
But I believe this could be easily fixed by changing

$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];

to

$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? $num_pages : $_GET['p'];

And now for why this is a handy feature:
Say you have a large thread and you bookmark it. Every day at least a page gets added, and you usually just need the information from the last 2 or 3 posts. Just bookmark that page with page number 9999 or so, and you'll always be at the last page smile

No huge thing, just a little handyness smile

-- Bekko

Re: Small update in pagination

It's not quite that simple. With your suggested change, you'll end up on the last page if you don't supply the script with a page number.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by Jansson 2006-09-02 23:07)

Re: Small update in pagination

if(!isset($_GET['p']) || $_GET['p'] <= 1) $p = 1;
else if($_GET['p'] > $num_pages) $p = $num_pages;
else $p = $_GET['p'];

Might be a few lines too much for a feature nobody will notice tongue

Re: Small update in pagination

Rickard wrote:

It's not quite that simple. With your suggested change, you'll end up on the last page if you don't supply the script with a page number.

Good point. Well, Jannson's fix seems good too tongue And like I said, it's just a minor thing, I can live without it.