<?php
require_once '../config/database.php';
require_once '../includes/functions.php';

header('Content-Type: application/json');

$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$pageSize = 10;

$articles = fetchNewsFromAPI($page, $pageSize);

echo json_encode(['articles' => $articles]);
?>