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 wink

Re: paginate function

I'm not sure I understand. Where is the problem?

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

Re: paginate function

In the paginate function, $cur_page can never be -1 wink

Re: paginate function

From viewforum.php:

$subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: paginate function

OK: I thought it allowed you to show all the pages in viewforum.php for that specifc forum on the bottom