This is one of the ways to do it. I would only suggest using an Exit loop action instead of a Go to + Label.
Alternatively, one can also try extracting a total number of results available (if that number is available somewhere) and divide that by the number of pages. Then round the result and use the number in the loop.
It is also sometimes possible to pass the page index to the URL and then do that while incrementing the page index until the page does not load (or has no results).
It can also be possible to check if the results are the same as from the previous page, or if the page number is the same as from the previous page, indicating that pressing the Next page button did not really take us to the next page.
Plenty of ways to do it. Usually depends on the page.