From 4f7c52e9e385041320179dcb7d27a9217a353c71 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 10 Jul 2006 15:55:10 +0000 Subject: fix some bugs... again. :) git-svn-id: file:///svn/phpbb/trunk@6165 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4a8570f762..ccc17c7f6e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -390,6 +390,12 @@ if ($hilit_words) $highlight = urlencode($hilit_words); } +// Make sure $start is set to the last page if it exceeds the amount +if ($start < 0 || $start > $total_posts) +{ + $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page']; +} + // General Viewtopic URL for return links $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')); -- cgit v1.2.1