reworked Pagination::make_link(), make it more robust. Closes #1271