func New(page, perPage, total int, sort, sortBy string) *Pages {
	if perPage <= 0 {
		perPage = DefaultPageSize
	}
	if perPage > MaxPageSize {
		perPage = MaxPageSize
	}
	pageCount := -1
	if total >= 0 {
		pageCount = (total + perPage - 1) / perPage
		if page > pageCount {
			page = pageCount
		}
	}
	if page < 1 {
		page = 1
	}
	if len(sort) > 0 && len(sortBy) == 0 {
		sortBy = "asc"
	}
	return &Pages{
		Page:       page,
		PerPage:    perPage,
		PageCount:  pageCount,
		TotalCount: total,
		Sort:       sort,
		SortBy:     sortBy,
	}
}
New creates a new Pages instance.
The page parameter is 1-based and refers to the current page index/number.
The perPage parameter refers to the number of items on each page.
And the total parameter specifies the total number of data items.
If total is less than 0, it means total is unknown.
package pagination
import (
	"net/http"
	"strconv"
)
var (
	DefaultPageSize = 100
	MaxPageSize = 5000
	PageVar = "page"
	PageSizeVar = "size"
	Sort = "sort"
	SortBy = "sortBy"
)
type Pages struct {
	Page       int         `json:"page"`
	PerPage    int         `json:"size"`
	PageCount  int         `json:"page_count"`
	TotalCount int         `json:"total_count"`
	Items      interface{} `json:"items"`
	Sort       string      `json:sort`
	SortBy     string      `json:sortBy`
}