dirPagination: replace jQuery method with jQLite

Accidentally used the `element.last()` method, which is not part of the
jQLite API. Replaced it with a compatible equivalent.