Updated the pagination_links function