{"id":49978358,"url":"https://github.com/sujeetkv/py-paginator","last_synced_at":"2026-05-18T13:14:19.733Z","repository":{"id":62582360,"uuid":"144987728","full_name":"sujeetkv/py-paginator","owner":"sujeetkv","description":"Paginator to generate page numbers for pagination","archived":false,"fork":false,"pushed_at":"2018-12-18T12:54:11.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-04T00:12:50.704Z","etag":null,"topics":["pagination","paginator","python","python-libary","python-utility"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sujeetkv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-16T12:55:45.000Z","updated_at":"2024-09-06T23:59:46.000Z","dependencies_parsed_at":"2022-11-03T21:34:26.393Z","dependency_job_id":null,"html_url":"https://github.com/sujeetkv/py-paginator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sujeetkv/py-paginator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujeetkv%2Fpy-paginator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujeetkv%2Fpy-paginator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujeetkv%2Fpy-paginator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujeetkv%2Fpy-paginator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sujeetkv","download_url":"https://codeload.github.com/sujeetkv/py-paginator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujeetkv%2Fpy-paginator/sbom","scorecard":{"id":857880,"data":{"date":"2025-08-11","repo":{"name":"github.com/sujeetkv/py-paginator","commit":"efec16c1d9fc9a917eca87c3c15719ab8771d061"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T00:23:41.539Z","repository_id":62582360,"created_at":"2025-08-24T00:23:41.539Z","updated_at":"2025-08-24T00:23:41.539Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33178915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pagination","paginator","python","python-libary","python-utility"],"created_at":"2026-05-18T13:14:14.077Z","updated_at":"2026-05-18T13:14:19.726Z","avatar_url":"https://github.com/sujeetkv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-paginator\nPaginator to generate page numbers for pagination\n\n[![Build Status](https://travis-ci.org/sujeetkv/py-paginator.svg?branch=master)](https://travis-ci.org/sujeetkv/py-paginator)\n[![PyPI Version](https://img.shields.io/pypi/v/py-paginator.svg)](https://pypi.org/project/py-paginator)\n\n## Installation\n\n```bash\npip install py-paginator\n```\n\n## Usage Example with flask framework\n\n- **app.py**\n\n```python\nfrom flask import Flask, request, render_template\nfrom py_paginator import Paginator\n\napp = Flask(__name__)\napp.jinja_env.add_extension('jinja2.ext.do')\n\n@app.route('/')\ndef home():\n    page = int(request.args.get('page', 1))\n    limit = 20\n\n    records_count = get_records_count() # get records count from storage\n\n    paginator = Paginator(total_items=records_count, item_limit=limit, curr_page=page)\n\n    records = get_records(limit=paginator.item_limit, offset=paginator.item_offset) # get records from storage\n\n    return render_template('home.html', records=records, paginator=paginator)\n```\n\n Here `paginator.item_limit` and `paginator.item_offset` can be used in database query to apply limit. `paginator` object can be used in templates to create pagination links.\n\n- **templates/macros.html**\n\n```html\n{#\n    :paginator: Paginator object\n    :endpoint: flask request endpoint\n    :pager: If True it will show a pager instead of numbered pagination\n\n    - you can also pass further arguments that will be passed into `url_for()` of every link.\n#}\n{% macro render_pagination(paginator, endpoint=request.endpoint, pager=False) %}\n    {% if paginator.has_pages %}\n        {% do kwargs.update(request.args) %}\n        {% do kwargs.pop('page', None) %}\n        \u003cnav aria-label=\"Page navigation\"\u003e\n            {% if pager %}\n                {% set pager = paginator.get_pager() %}\n                \u003cul class=\"pager\"\u003e\n                    \u003cli class=\"previous{% if not paginator.has_prev %} disabled{% endif %}\"\u003e\n                        {% do kwargs.update({'page': pager.prev}) %}\n                        \u003ca href=\"{% if paginator.has_prev %}{{ url_for(endpoint, **kwargs) }}{% else %}#{% endif %}\"\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026laquo;\u003c/span\u003e Prev\u003c/a\u003e\n                    \u003c/li\u003e\n                    \u003cli class=\"next{% if not paginator.has_next %} disabled{% endif %}\"\u003e\n                        {% do kwargs.update({'page': pager.next}) %}\n                        \u003ca href=\"{% if paginator.has_next %}{{ url_for(endpoint, **kwargs) }}{% else %}#{% endif %}\"\u003eNext \u003cspan aria-hidden=\"true\"\u003e\u0026raquo;\u003c/span\u003e\u003c/a\u003e\n                    \u003c/li\u003e\n                \u003c/ul\u003e\n            {% else %}\n                \u003cul class=\"pagination\"\u003e\n                    {% for page_type, page_num in paginator.get_pages() %}\n                        {% do kwargs.update({'page': page_num}) %}\n                        {% if page_type == 'prev' %}\n                            {% if page_num %}\n                                \u003cli\u003e\u003ca href=\"{{ url_for(endpoint, **kwargs) }}\" aria-label=\"Previous\"\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026laquo;\u003c/span\u003e\u003c/a\u003e\u003c/li\u003e\n                            {% else %}\n                                \u003cli class=\"disabled\"\u003e\u003cspan\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026laquo;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\n                            {% endif %}\n                        {% elif page_type == 'next' %}\n                            {% if page_num %}\n                                \u003cli\u003e\u003ca href=\"{{ url_for(endpoint, **kwargs) }}\" aria-label=\"Next\"\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026raquo;\u003c/span\u003e\u003c/a\u003e\u003c/li\u003e\n                            {% else %}\n                                \u003cli class=\"disabled\"\u003e\u003cspan\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026raquo;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\n                            {% endif %}\n                        {% elif page_type == 'ellip' %}\n                            \u003cli class=\"disabled\"\u003e\u003cspan\u003e\u003cspan aria-hidden=\"true\"\u003e\u0026hellip;\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\n                        {% elif page_type == 'curr' %}\n                            \u003cli class=\"active\"\u003e\u003cspan\u003e{{ page_num }}\u003c/span\u003e\u003c/li\u003e\n                        {% else %}\n                            \u003cli\u003e\u003ca href=\"{{ url_for(endpoint, **kwargs) }}\"\u003e{{ page_num }}\u003c/a\u003e\u003c/li\u003e\n                        {% endif %}\n                    {% endfor %}\n                \u003c/ul\u003e\n            {% endif %}\n        \u003c/nav\u003e\n    {% endif %}\n{% endmacro %}\n```\n\n- **templates/home.html**\n\n```html\n{% from \"macros.html\" import render_pagination with context %}\n\n\u003ch1\u003eTotal Records: {{ paginator.total_items }}\u003c/h1\u003e\n\u003ch2\u003eTotal Pages: {{ paginator.total_pages }}\u003c/h2\u003e\n\n{% for record in records %}\n    \u003cp\u003e{{ loop.index + paginator.item_offset }} - {{ record.field_name }}\u003c/p\u003e\n{% else %}\n    \u003cp\u003eNo Records found.\u003c/p\u003e\n{% endfor %}\n\n{{ render_pagination(paginator) }}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujeetkv%2Fpy-paginator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujeetkv%2Fpy-paginator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujeetkv%2Fpy-paginator/lists"}