better function to truncate page titles