Ver Fonte

Merge pull request #51 from josejibin/fix/per-page-logic

Fix: perPage logic in `getPagination`
Kailash Nadh há 5 anos atrás
pai
commit
e230baca3b
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      handlers.go

+ 2 - 2
handlers.go

@@ -186,8 +186,8 @@ func getPagination(q url.Values) pagination {
 		perPage = 0
 	} else {
 		ppi, _ := strconv.Atoi(pp)
-		if ppi < 1 || ppi > maxPerPage {
-			perPage = defaultPerPage
+		if ppi > 0 && ppi <= maxPerPage {
+			perPage = ppi
 		}
 	}