<?php
$path = '../../../';
require($path . 'core/includes/header.inc.php');

if ($_REQUEST['type'] && in_array($_REQUEST['type'], ['paths', 'categories', 'brands', 'headings', 'redirects'])) {
    $type = $_REQUEST['type'];
    header('Content-Type: application/csv;charset=UTF-8');
    header('Content-Disposition: attachment; filename=' . clean_value(config('app.name') . '_' . $type) . '.csv');
    header('Pragma: no-cache');
    // T80223 - make the CSV to be UTF-8 friendly
    echo "\xef\xbb\xbf";
    SeoCsv::csvPrint($type);
} else {
    header("Connection: close");
}
