Revert "Revert "Fix #10 truncate pagination if it has more elements than we can show on the same line""

This reverts commit ec40dd740d5d60c4e5ae68be01ba874e40e373b6.
fixed pagination offset logic