From f9c9f5856162c5f459122ca3b9364d56f3c46390 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 6 Sep 2014 03:56:15 -0400 Subject: [PATCH] post_index fix --- src/controllers/topics.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index bfc2b4e396..6e72f3a446 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -62,9 +62,10 @@ topicsController.get = function(req, res, next) { } var postIndex = 0; + req.params.post_index = req.params.post_index || 0; if (!settings.usePagination) { if (reverse) { - if (!req.params.post_index || parseInt(req.params.post_index, 10) === 1) { + if (parseInt(req.params.post_index, 10) === 1) { req.params.post_index = 0; } postIndex = Math.max(postCount - (req.params.post_index || postCount) - (settings.postsPerPage - 1), 0);