Use findIndex to find the index of a page