|
|
@ -8,8 +8,8 @@ module.exports = async (req, res, next) => { |
|
|
|
|
|
|
|
|
|
|
|
const page = req.params.page === 'index' ? 1 : req.params.page; |
|
|
|
const page = req.params.page === 'index' ? 1 : req.params.page; |
|
|
|
try { |
|
|
|
try { |
|
|
|
const maxPage = Math.min(Math.ceil((await Posts.getPages(req.params.board)) / 10), Math.ceil(res.locals.board.settings.threadLimit/10)); |
|
|
|
const maxPage = Math.min(Math.ceil((await Posts.getPages(req.params.board)) / 10), Math.ceil(res.locals.board.settings.threadLimit/10)) || 1; |
|
|
|
if (page > maxPage && maxPage > 0) { |
|
|
|
if (page > maxPage) { |
|
|
|
return next(); |
|
|
|
return next(); |
|
|
|
} |
|
|
|
} |
|
|
|
await buildBoard(res.locals.board, page, maxPage); |
|
|
|
await buildBoard(res.locals.board, page, maxPage); |
|
|
|