1👍
✅
page
seems to be a string type here not an integer while all_pages
is integer. So you can not compare them.
Also I would suggest to pass your variables as url arguments, instead of your current approach, it will be much cleaner and faster.
Source:stackexchange.com