35 lines
No EOL
1.8 KiB
Text
35 lines
No EOL
1.8 KiB
Text
<nav>
|
|
<ul class="pagination">
|
|
<li class="page-item <%= (pageNumber === 0 ? "disabled" : "") %>">
|
|
<% if (pageNumber === 0) { %>
|
|
<a class="page-link" aria-label="First Page"><i class="bi bi-chevron-double-left"></i></a>
|
|
<% } else { %>
|
|
<a class="page-link" aria-label="First Page" href="?pageNumber=0"><i class="bi bi-chevron-double-left"></i></a>
|
|
<% } %>
|
|
</li>
|
|
<li class="page-item <%= (pageNumber === 0 ? "disabled" : "") %>">
|
|
<% if (pageNumber === 0) { %>
|
|
<a class="page-link" aria-label="Previous Page"><i class="bi bi-chevron-left"></i></a>
|
|
<% } else { %>
|
|
<a class="page-link" aria-label="Previous Page" href="?pageNumber=<%= (pageNumber - 1) %>"><i class="bi bi-chevron-left"></i></a>
|
|
<% } %>
|
|
</li>
|
|
<% for (let i = Math.max(pageNumber - (2 + (2 - Math.min(pageCount - 1 - pageNumber, 2))), 0); i < Math.min(pageNumber + Math.max(5 - pageNumber, 3), pageCount); i++) { %>
|
|
<li class="page-item <%= (i === pageNumber ? "active" : "") %>"><a class="page-link" aria-label="Go to page <%= (i + 1) %>" href="?pageNumber=<%= i %>"><%= (i + 1) %></a></li>
|
|
<% } %>
|
|
<li class="page-item <%= (pageNumber >= pageCount - 1 ? "disabled" : "") %>">
|
|
<% if (pageNumber >= pageCount - 1) { %>
|
|
<a class="page-link" aria-label="Next Page"><i class="bi bi-chevron-right"></i></a>
|
|
<% } else { %>
|
|
<a class="page-link" aria-label="Next Page" href="?pageNumber=<%= (pageNumber + 1) %>"><i class="bi bi-chevron-right"></i></a>
|
|
<% } %>
|
|
</li>
|
|
<li class="page-item <%= (pageNumber >= pageCount - 1 ? "disabled" : "") %>">
|
|
<% if (pageNumber >= pageCount - 1) { %>
|
|
<a class="page-link" aria-label="Last Page"><i class="bi bi-chevron-double-right"></i></a>
|
|
<% } else { %>
|
|
<a class="page-link" aria-label="Last Page" href="?pageNumber=<%= (pageCount - 1) %>"><i class="bi bi-chevron-double-right"></i></a>
|
|
<% } %>
|
|
</li>
|
|
</ul>
|
|
</nav> |