handle first and last page views