From e827a3355e8d1f5e3dd3faf6fab6c8364fb17ec2 Mon Sep 17 00:00:00 2001 From: db0 Date: Tue, 12 Sep 2023 01:24:40 +0200 Subject: [PATCH] fix: prevent crash when page < 1 --- fediseer/database/functions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fediseer/database/functions.py b/fediseer/database/functions.py index 2b8512a..186ea43 100644 --- a/fediseer/database/functions.py +++ b/fediseer/database/functions.py @@ -323,4 +323,7 @@ def get_reports( if report_activity is not None: query = query.filter(Report.report_activity == report_activity.name ) + page = page - 1 + if page < 1: + page = 1 return query.order_by(Report.created.desc()).offset(10 * (page - 1)).limit(10).all()