Declare your inital offset as 1 (referring to pageNumber as 1 and can be referred as $offset$) and Page sizing as 25 (which can be referred as $limit$ variable) in your script.
And lastly, write the script with appropriate condition. For example, if you have a varilable called totalpages in your response. You can write the script as below: