Calculate Page index and offset