<% if (firstPage != currentPage) { %>First<% } else { %>First<% } %>
<% if (currentPage > firstPage) { %>Previous<% } %>
<% if (currentPage - 5 > firstPage) { %>...<% } %>
<% for (var p=currentPage-5; p<=currentPage+5; p++) { %>
<% if (p < firstPage || p > lastPage) continue; %>
<% if (currentPage == p) { %>
<%= p %>
<% } else { %>
<%= p %>
<% } %>
<% } %>
<% if (currentPage + 5 < lastPage) { %>...<% } %>
<% if (currentPage < totalPages) { %>Next<% } %>
<% if (lastPage != currentPage) { %>Last<% } else { %>Last <%} %>