diff --git a/api/helpers.go b/api/helpers.go index 8c084ebf7..fc1945459 100644 --- a/api/helpers.go +++ b/api/helpers.go @@ -299,6 +299,9 @@ func parsePaginationParams(paramPage, paramLimit string) (PaginationParams, erro func calculatePagination(page int, limit int, totalItems uint64) (*Pagination, error) { // pages start at 0 index, for legacy reasons lastp := int(math.Ceil(float64(totalItems)/float64(limit)) - 1) + if totalItems == 0 { + lastp = 0 + } if page > lastp || page < 0 { return nil, ErrPageNotFound