<?php
require_once dirname(__DIR__) . '/install_link_lib.php';

$cases = [
    'http://192.168.1.10:8080/' => 'http://192.168.1.10:8080/mikrotik/admin',
    'http://192.168.1.10:8080/mikrotik' => 'http://192.168.1.10:8080/mikrotik/admin',
    'http://192.168.1.10:8080/mikrotik/admin' => 'http://192.168.1.10:8080/mikrotik/admin',
    'https://main.example.com/admin' => 'https://main.example.com/admin',
];
foreach ($cases as $input => $expected) {
    $actual = ua_link_admin_url($input);
    if ($actual !== $expected) {
        throw new RuntimeException("Admin URL mismatch for {$input}: {$actual}");
    }
}
echo "PASS link admin URL normalization" . PHP_EOL;
