delete pLastPageの前に、pLastPage->PageIndex = pLastPage->PageIndex - 1 を入れれば?