Metalsmith just needs better pagination.
npm install metalsmith-better-pagination
See this metalsmith plugin for an exhaustive list of options and usage notes.
Sometimes computing the page numbers is difficult. My suggestion is to start from page 1, and then increment by 1 each time (e.g. the next page would be 2, then 3, and so on). See this issue for more details about the complicated mathematics involved. These plugins exist so you won't have to work hard lol!