<#macro paginate currentPage totalPage actionUrl> <#if (totalPage <= 0) || (currentPage > totalPage)><#return> <#local startPage = currentPage - 4> <#if (startPage < 1)><#local startPage = 1> <#local endPage = currentPage + 4> <#if (endPage > totalPage)><#local endPage = totalPage>
共${page.totalRows}条，共${page.totalPages}页记录
<#if (currentPage <= 8)> <#local startPage = 1> <#if ((totalPage - currentPage) < 8)> <#local endPage = totalPage> <#if (currentPage == 1)> 上一页 <#else> <#if currentPage == 2> <#local prevPageUrl = "/cms?p=" + p> 上一页 <#else> <#local prevPageUrl = "/cms?p=" + p + "&page=" + (currentPage - 1) > 上一页 <#if (currentPage > 8)> #{1} #{2} … <#list startPage..endPage as i> <#if currentPage == i> #{i} <#else> <#if i == 1> <#local prevPageUrl = "/cms?p=" + p>1 <#else> <#local currentPageUrl = "/cms?p=" + p + "&page=" + i >#{i} <#if ((totalPage - currentPage) >= 8)> … #{totalPage - 1} #{totalPage} <#if (currentPage == totalPage)> 下一页 <#else> <#local nextPageUrl = "/cms?p=" + p + "&page=" + (currentPage + 1) > 下一页