}
if start < int(rows / rows_x_page) * rows_x_page {
- ret += fmt.Sprintf(`<li class="page-item">
+ successiva := start + rows_x_page
+ if successiva >= rows {
+ ret += `<li class="page-item disabled">
+ <a class="page-link" href="#" aria-label="Successiva" title="Successiva">
+ <span aria-hidden="true">›</span>
+ </a>
+ </li>`
+ ret += `<li class="page-item disabled">
+ <a class="page-link" href="#" aria-label="Ultima" title="Ultima">
+ <span aria-hidden="true">»</span>
+ </a>
+ </li>`
+ } else {
+ ret += fmt.Sprintf(`<li class="page-item">
<a class="page-link" href="%s/%d" aria-label="Successiva" title="Successiva">
<span aria-hidden="true">›</span>
</a>
- </li>`, url, start + rows_x_page)
- ret += fmt.Sprintf(`<li class="page-item">
+ </li>`, url, successiva)
+ ultima := (rows / rows_x_page) * rows_x_page
+ if ultima >= rows {
+ ultima -= rows_x_page
+ }
+ ret += fmt.Sprintf(`<li class="page-item">
<a class="page-link" href="%s/%d" aria-label="Ultima" title="Ultima">
<span aria-hidden="true">»</span>
</a>
- </li>`, url, (rows / rows_x_page) * rows_x_page)
+ </li>`, url, ultima)
+ }
} else {
ret += `<li class="page-item disabled">
<a class="page-link" href="#" aria-label="Successiva" title="Successiva">