For this you might not want to use the
DocumentName because it will have spaces in it, look at
NodeAlias instead because that will have the spaces replaced with dashes.
Lastly, you could use the first suggestion Dawid suggests and add a field to your page types for the user to select a class OR have a default one. Then place that code in the master page template layout and you'll be set. I use this method all the time and it won't break when someone decides to change the name of the page.