Topic: paginate function
I was looking around the code, and I found this in the paginate function
// If $cur_page == -1, we link to all pages (used in viewforum.php)
if ($cur_page == -1)
{
$cur_page = 1;
$link_to_all = true;
}
Curious, I tried it. It didn't work. I checked the code in viewforum.php and found the problem:
$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
$start_from = $pun_user['disp_topics'] * ($p - 1);
Basically, if you ever set p to lower than 1, it's set to 1 before paginate is called. However, fixing it isn't so easy, since allowing -1 causes a negative LIMIT, which spits out an SQL error