From 748d31787036fbd83c2169da1c6eabb67f99500d Mon Sep 17 00:00:00 2001 From: Amin Alaee Date: Mon, 6 May 2024 16:00:57 +0200 Subject: [PATCH] Update application.py --- sqladmin/application.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sqladmin/application.py b/sqladmin/application.py index e6da646d..41397acf 100644 --- a/sqladmin/application.py +++ b/sqladmin/application.py @@ -440,6 +440,14 @@ async def list(self, request: Request) -> Response: pagination = await model_view.list(request) pagination.add_pagination_urls(request.url) + if ( + pagination.page * pagination.page_size + > pagination.count + pagination.page_size + ): + raise HTTPException( + status_code=400, detail="Invalid page or pageSize parameter" + ) + context = {"model_view": model_view, "pagination": pagination} return await self.templates.TemplateResponse( request, model_view.list_template, context