From d8a1e98a433a01f54b4ec493bca1289fbdc0bc88 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 26 Nov 2016 01:18:57 +0300 Subject: [PATCH] fix permalinks on pagination --- src/controllers/topics.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 20c2b87cbd..1224de5bcd 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -105,9 +105,9 @@ topicsController.get = function (req, res, callback) { } else if (!req.query.page) { var index; if (reverse) { - index = Math.max(0, postCount - (req.params.post_index || postCount)); + index = Math.max(0, postCount - (req.params.post_index || postCount) + 2); } else { - index = Math.max(0, req.params.post_index - 1) || 0; + index = Math.max(0, req.params.post_index) || 0; } currentPage = Math.max(1, Math.ceil(index / settings.postsPerPage));