show page 1 even if there is nothing to page
This commit is contained in:
parent
f18e31811c
commit
24c210e395
@ -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)
|
||||
|
@ -73,7 +73,7 @@ app:get("topic", "/:slug", function(self)
|
||||
}))
|
||||
self.topic = topic
|
||||
|
||||
self.pages = math.ceil(threads_count / THREADS_PER_PAGE)
|
||||
self.pages = math.max(math.ceil(threads_count / THREADS_PER_PAGE), 1)
|
||||
self.page = math.max(1, math.min(tonumber(self.params.page) or 1, self.pages))
|
||||
-- self.threads_list = db.query("SELECT * FROM threads WHERE topic_id = ? ORDER BY is_stickied DESC, created_at DESC", topic.id)
|
||||
self.threads_list = db.query([[
|
||||
|
Loading…
Reference in New Issue
Block a user