from ..ghost_db import DBClient


async def pages_data(session, page, search):
    client = DBClient(session)

    pages, pagination = await client.list_pages(
        limit=10,
        page=page,
        search=search,
    )

    return {
        "pages": pages,
        "page": pagination.get("page", page),
        "total_pages": pagination.get("pages", 1),
        "search": search,
    }
