Fixed problem in lastPage logic. Last page and first page checks for disabling prev and next buttons.