Reference

page.changeTitle:before

$page, $title

Example

/site/config/config.php
return [
    'hooks' => [
        'page.changeTitle:before' => function ($page, $title) {
            // your code goes here
        }
    ]
]