Fix afterMove callback index on moveUp/moveDown

When using the moveUp/moveDown functions (either through user input or
directly), the index passed to the afterMove callback is the index of
the source page, rather than the destination page. Fix this issue, and
deal with the edge case where the page might have looping enabled and
the user might want to loop to the last page from the first page.