It depends what you mean by page number. There are 2 options: (a) the physical number of the page, counting the first page as 0; (b) the name of the page (e.g. page xii, etc).
To get the physical number of the page, given myPage as a Page object:
To get the name of the page:
I need the physical number. I'm confirming this works. Thanks!
We need to be able to determine it based on a named layer. Example: A layer named "story" is on page X.
That's a different question. You should mark this one as correct, and post another. When you do, add some details, because to me at least it's not clear what you're asking.