validate per_page before page

plus an additional check just in case
Closes #1688
This commit is contained in:
Anton Kaliaev
2018-06-05 16:20:48 +04:00
parent 3445f1206e
commit 2ce8179c8b
3 changed files with 7 additions and 1 deletions

View File

@@ -125,6 +125,10 @@ func SetEventBus(b *types.EventBus) {
}
func validatePage(page, perPage, totalCount int) int {
if perPage < 1 {
return 1
}
pages := ((totalCount - 1) / perPage) + 1
if page < 1 {
page = 1