diff --git a/app/routes/threads.py b/app/routes/threads.py index 0b39aef..06f0fe8 100644 --- a/app/routes/threads.py +++ b/app/routes/threads.py @@ -31,7 +31,7 @@ def thread(slug): ("id", "<=", after_id), ]) print(post_position) - page = math.floor((post_position + 1) / POSTS_PER_PAGE) + 1 + page = math.ceil((post_position) / POSTS_PER_PAGE) else: page = max(1, min(page_count, int(request.args.get("page", default = 1)))) diff --git a/app/templates/common/macros.html b/app/templates/common/macros.html index cb859ea..50b7d3f 100644 --- a/app/templates/common/macros.html +++ b/app/templates/common/macros.html @@ -1,6 +1,6 @@ {% macro pager(current_page, page_count) %} -{% set left_start = (1, current_page - 5) | max %} -{% set right_end = (page_count, current_page + 5) | min %} +{% set left_start = [1, current_page - 5] | max %} +{% set right_end = [page_count, current_page + 5] | min %}