complete paging demo code