Definition
/**
* Transform a SQL query into a COUNT query for pagination.
*
* Wraps the query in: SELECT COUNT(*) FROM (...) AS _count_subq
* Removes ORDER BY and LIMIT/OFFSET from the inner query.
*
* @param string $sql The SQL query to transform
*
* @return string The COUNT query
*/
sql_to_count_query(string $sql) : string