diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 64db92ec08..b925568127 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -91,7 +91,7 @@ topicsController.get = function(req, res, next) { postIndex = Math.max((req.params.post_index || 1) - (settings.postsPerPage + 1), 0); } } else if (!req.query.page) { - var index = Math.max(req.params.post_index - 1, 0); + var index = Math.max(req.params.post_index - 1, 0) || 0; page = Math.max(1, Math.ceil(index / settings.postsPerPage)); }