A simple paginator in JavaScript