Fix problems with next page and previous page buttons in diary