Update auto-pagination.js

Update the two functions