{{- /*gotype: git.handmade.network/hmn/hmn/src/templates.Pagination*/ -}}
{{ if gt .Total 1 }}
    <div class="pagination flex">
        {{ if gt .Current 1 }}
            <a class="button" href="{{ .PreviousUrl }}">Prev</a>
        {{ end }}
        {{ if gt .Current 1 }}
            {{ if gt .Current 2 }}
                <a class="page button" href="{{ .FirstUrl }}">1</a>
            {{ end }}
            {{ if gt .Current 3 }}
                <a class="page button">&nbsp;&nbsp;...&nbsp;&nbsp;</a>
            {{ end }}
            <a class="page button" href="{{ .PreviousUrl }}">{{ sub .Current 1 }}</a>
        {{ end }}
        <a class="page button current">{{ .Current }}</a>
        {{ if lt .Current .Total }}
            <a class="page button" href="{{ .NextUrl }}">{{ add .Current 1 }}</a>
            {{ if lt .Current (sub .Total 2) }}
                <a class="page button">&nbsp;&nbsp;...&nbsp;&nbsp;</a>
            {{ end }}
            {{ if lt .Current (sub .Total 1) }}
                <a class="page button" href="{{ .LastUrl }}">{{ .Total }}</a>
            {{ end }}
        {{ end }}
        {{ if lt .Current .Total }}
            <a class="button" href="{{ .NextUrl }}">Next</a>
        {{ end }}
    </div>
{{ end }}
