Setting pageIndex now works correctly in all cases.

Fixed lastPageIndex so it does not return MAXINT when there are no pages. The reloadData method now updates the number of pages before it updates the current page index.