API: fix commits pagination

closes #2300