show page 1 even if there is nothing to page

This commit is contained in:
2025-05-21 20:00:01 +03:00
parent f18e31811c
commit 24c210e395
2 changed files with 2 additions and 2 deletions

View File

@ -72,7 +72,7 @@ app:get("thread", "/:slug", function(self)
local post_count = Posts:count(db.clause({
thread_id = thread.id
}))
self.pages = math.ceil(post_count / POSTS_PER_PAGE)
self.pages = math.max(math.ceil(post_count / POSTS_PER_PAGE), 1)
if self.params.after then
local after_id = tonumber(self.params.after)