Adding ajax pagination

why are you not conctracting 4 like in below code, i know those are start,previous,next,end buttons, but you are not taking them into account here

if ($numberOfPages > $paginationButtons - 4)