How can I get the page number above the image?

On the master page, open the layers panel. Create a new layer. Make sure that the page number text box is positioned in the top layer.