have a look at https://codex.wordpress.org/Global_Variables#Inside_the_Loop_variables
within the loop, the global variables related to the <!--nextpage--> tag are:
$page - the actual sub page,
$multipage - (boolean) =1 if nextpage was used
$numpages - total number of sub pages