For exemple in this code, is htmlspecialchar preventing XSS and is the PDO prepared statement preventing SQL injection ?
if(isset($_GET['search']) AND !empty($_GET['search']) AND $_GET['search'] != ' ') {
    $search = htmlspecialchars($_GET['search']);
    $searchArray = explode(' ',$search);
    var_dump($searchArray);
    $videos = $stdb->prepare('SELECT id, title, videoTime FROM videos WHERE title LIKE "%'.$search.'%" OR title LIKE "%'.implode("\" OR title LIKE \"%", $searchArray).'%" ORDER BY id DESC limit '.$start.','.$videosPerPage);
    $videos->execute();
    $totalVideos = $totalVideosReq->rowcount();
    $totalPages = ceil($totalVideos/$videosPerPage);
    $currentPage = 1;
    if(isset($_GET['page']) AND !empty($_GET['page']) AND $_GET['page'] > 0 AND $_GET['page'] <= $totalPages) {
        $_GET['page'] = intval($_GET['page']);
        $currentPage = $_GET['page'];
    } else{
        $currentPage = 1;
    }
}
 
     
     
    