```php
<?php

require_once '../../core/api_bootstrap.php';

require_once '../../core/employee_auth.php';
EmployeeAuth::check('view_leads');

$data = Request::get();

try {

    $db = new Database();
    $conn = $db->connect();

    $page = $data['page'] ?? 1;
    $limit = $data['limit'] ?? 20;

    $offset = ($page - 1) * $limit;

    $query = "

        SELECT

        l.id,
        l.name,
        l.phone,
        l.whatsapp,
        l.email,
        l.address,
        l.pincode,

        c.name AS category_name,
        sc.name AS subcategory_name,

        l.status,
        l.created_at,
        l.distributed_providers

        FROM customer_leads l

        LEFT JOIN categories c
        ON l.category_id = c.id

        LEFT JOIN sub_categories sc
        ON l.sub_category_id = sc.id

        ORDER BY l.created_at DESC

        LIMIT :limit OFFSET :offset

    ";

    $stmt = $conn->prepare($query);

    $stmt->bindValue(':limit',(int)$limit,PDO::PARAM_INT);
    $stmt->bindValue(':offset',(int)$offset,PDO::PARAM_INT);

    $stmt->execute();

    $leads = $stmt->fetchAll();

    Response::success($leads);

}
catch(Exception $e){

    Logger::log("system.log",$e->getMessage());

    Response::error("Server error",500);

}