# Path: gogdb/views/pagination.py
# def calc_pageinfo(page, num_products, items_per_page):
#     num_pages = int(math.ceil(num_products / items_per_page))
#     page = min(max(page, 1), num_pages)
#     offset = (page - 1) * items_per_page
#     page_info = {
#         "is_first": page == 1,
#         "is_last": page == num_pages,
#         "page": page,
#         "num_pages": num_pages,
#         "from": offset,
#         "to": offset + items_per_page,
#         "prev_link": "", # Filled in later
#         "next_link": ""
#     }
#     return page_info
# 
# Path: gogdb/application/datasources.py
# def get_indexdb():
#     if "indexdb" not in flask.g:
#         storagedb = get_storagedb()
#         index_path = storagedb.path_indexdb()
#         flask.g.indexdb = sqlite3.connect(index_path)
#         flask.g.indexdb.row_factory = sqlite3.Row
# 
#     return flask.g.indexdb


import datetime
import flask
import gogdb.core.model as model
from gogdb.views.pagination import calc_pageinfo
from gogdb.application.datasources import get_indexdb



ITEMS_PER_PAGE = 100


def changelog():
    page = int(flask.request.args.get("page", "1"))


# Path: gogdb/views/pagination.py
# def calc_pageinfo(page, num_products, items_per_page):
#     num_pages = int(math.ceil(num_products / items_per_page))
#     page = min(max(page, 1), num_pages)
#     offset = (page - 1) * items_per_page
#     page_info = {
#         "is_first": page == 1,
#         "is_last": page == num_pages,
#         "page": page,
#         "num_pages": num_pages,
#         "from": offset,
#         "to": offset + items_per_page,
#         "prev_link": "", # Filled in later
#         "next_link": ""
#     }
#     return page_info
# 
# Path: gogdb/application/datasources.py
# def get_indexdb():
#     if "indexdb" not in flask.g:
#         storagedb = get_storagedb()
#         index_path = storagedb.path_indexdb()
#         flask.g.indexdb = sqlite3.connect(index_path)
#         flask.g.indexdb.row_factory = sqlite3.Row
# 
#     return flask.g.indexdb


# Path: gogdb/views/changelog.py
import datetime
import flask
import gogdb.core.model as model
from gogdb.views.pagination import calc_pageinfo
from gogdb.application.datasources import get_indexdb




ITEMS_PER_PAGE = 100


def changelog():
    page = int(flask.request.args.get("page", "1"))


    cur = get_indexdb().cursor()