func New(page, perPage, total int) *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
	}
	return &Pages{
		Page:       page,
		PerPage:    perPage,
		TotalCount: total,
		PageCount:  pageCount,
	}
}
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 (
	"fmt"
	"net/http"
	"strconv"
	"strings"
)
var (
	DefaultPageSize = 100
	MaxPageSize = 1000
	PageVar = "page"
	PageSizeVar = "per_page"
)
type Pages struct {
	Page       int         `json:"page"`
	PerPage    int         `json:"per_page"`
	PageCount  int         `json:"page_count"`
	TotalCount int         `json:"total_count"`
	Items      interface{} `json:"items"`
}