From 34593ef428ff0d2024c44d094c59459ac021c775 Mon Sep 17 00:00:00 2001 From: Howl Date: Thu, 7 Apr 2016 12:08:44 +0200 Subject: [PATCH] Fix paginate spawning mysql errors --- common/paginate.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/paginate.go b/common/paginate.go index 27c9f9f..e679e13 100644 --- a/common/paginate.go +++ b/common/paginate.go @@ -28,6 +28,12 @@ func Paginate(page, limit string) string { lInt = 50 } } + if pInt < 1 { + pInt = 1 + } + if lInt < 1 { + lInt = 50 + } start := (pInt - 1) * lInt return fmt.Sprintf(" LIMIT %d,%d ", start, lInt) }