aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2008-10-16 19:12:12 +0000
committerChris Smith <toonarmy@phpbb.com>2008-10-16 19:12:12 +0000
commit77058f31c288c85a697ec9de85b2dd40d9af4349 (patch)
tree2aa64d5e1d99dfc267e71fb157d0189aefe7cc61 /phpBB/includes
parenta2e454262b89dfbcd022dcc2f36a9244aa4fb80e (diff)
downloadforums-77058f31c288c85a697ec9de85b2dd40d9af4349.tar
forums-77058f31c288c85a697ec9de85b2dd40d9af4349.tar.gz
forums-77058f31c288c85a697ec9de85b2dd40d9af4349.tar.bz2
forums-77058f31c288c85a697ec9de85b2dd40d9af4349.tar.xz
forums-77058f31c288c85a697ec9de85b2dd40d9af4349.zip
Correctly display topic in MCP when start parameter is equal to or greater than the number of posts. #30525
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9023 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/mcp/mcp_topic.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 9fabc41803..572dd5b0a6 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -114,11 +114,18 @@ function mcp_topic_view($id, $mode, $action)
{
$posts_per_page = $total;
}
+
if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page)
{
$start = 0;
}
+ // Make sure $start is set to the last page if it exceeds the amount
+ if ($start < 0 || $start >= $total)
+ {
+ $start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
+ }
+
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '