There’s no way to stop when the title changes, but you can maybe try to be more explicit as to which links should be treated as ‘next page’ links. For example, in addition to @class/@id, why not see if the URL structure changes in some way. If it does, see which URL segments are unique to the next page URLs you want and which ones aren’t. Then you can do something like:
Follow if /real-next-page-link/ part of next page URL
next_page_link: //a[@class=‘xxx’ and contains(@href, ‘/real-next-page-link/’)]
Don’t follow if next page URL contains /not-real-next-page/
next_page_link: //a[@class=‘xxx’ and not(contains(@href, ‘/not-real-next-page/’))]
long code, very powerfull
get the span numbering page parent and compare before-from-after, when before-from-after not match, then get the //a link, but when match will stop, with extra translation code for upper/lowercase and number double translate :), and effective for another domain too.