added parameter "length" to truncateTitle()