diff options
Diffstat (limited to 'api4/params.go')
-rw-r--r-- | api4/params.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api4/params.go b/api4/params.go index 15f632195..8bb072742 100644 --- a/api4/params.go +++ b/api4/params.go @@ -101,13 +101,13 @@ func ApiParamsFromRequest(r *http.Request) *ApiParams { params.PreferenceName = val } - if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil { + if val, err := strconv.Atoi(r.URL.Query().Get("page")); err != nil || val < 0 { params.Page = PAGE_DEFAULT } else { params.Page = val } - if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil { + if val, err := strconv.Atoi(r.URL.Query().Get("per_page")); err != nil || val < 0 { params.PerPage = PER_PAGE_DEFAULT } else if val > PER_PAGE_MAXIMUM { params.PerPage = PER_PAGE_MAXIMUM |