pagination works and buttons are hidden when they lead to a blank page