function initiateQuery(query) {
    if (query.DBlimit || query.DBpage || query.DBsort) {
        let limit = query.DBlimit;
        let page = query.DBpage;
        let sort = query.DBsort;

        if(!limit) {
            limit = 24;
        }

        if(page < 0) {
            page = 0;
        } else if (!page) {
            page = 0;
        }

        if(limit < 0) {
            limit = 0;
        } else if (!limit) {
            limit = 24;
        }

        delete query.DBlimit;
        delete query.DBsort;
        delete query.DBpage;
        return [query, parseInt(page), parseInt(limit), sort];
    } else {
        return [query, 0, 24, undefined];
    }
}

module.exports = initiateQuery
