Simplified `show_next_page` logic, fixed common prefix bug