diff --git a/html/login/register.php b/html/login/register.php
index 746b411e..ba618960 100644
--- a/html/login/register.php
+++ b/html/login/register.php
@@ -17,7 +17,7 @@ if (isset($_POST['username']) && isset($_POST['password1']) && isset($_POST['pas
$status = "Caractères illégaux";
} else {
$userEmail = isset($_POST['email']) ? strtolower($_POST['email']) : NULL;
- $userDisplayName = htmlspecialchars(substr($_POST['username']));
+ $userDisplayName = htmlspecialchars(substr($_POST['username'], 0, 20));
$userName = str_replace(" ", "_", strtolower(htmlspecialchars(substr($_POST['username'], 0, 20))));
$sqlRequest = "SELECT ID FROM users WHERE username = :username";