getPdo(); $stmt = $pdo->prepare("SELECT COUNT(*) FROM companies WHERE $whereSql"); $stmt->execute($params); $total = (int)$stmt->fetchColumn(); $offset = ($page - 1) * $limit; $stmt = $pdo->prepare( "SELECT id, name_zh, name_en, display_name, business_role, country, registration_number, address, legal_representative, industry, industry_subdivision, website, latest_employee_count, latest_annual_revenue, is_listed, stock_code, is_active, created_at, updated_at FROM companies WHERE $whereSql ORDER BY id DESC LIMIT $limit OFFSET $offset" ); $stmt->execute($params); $list = $stmt->fetchAll(); Response::success(['list' => $list, 'total' => $total, 'page' => $page, 'limit' => $limit]);