I suspect you are trying to the get the pager number before paginating the page collection.
This is a detailed description of the situation:
https://discourse.gohugo.io/t/determine-if-current-page-is-result-of-pagination/37494/4
The trick is to paginate before trying to access the pager number.
https://discourse.gohugo.io/t/control-pagination-and-page-collections-from-baseof-html/37643/8