added dynamic pagination function and used it in games.js