Index: wp-content/themes/twentytwelve/functions.php
===================================================================
--- wp-content/themes/twentytwelve/functions.php	(revision 22995)
+++ wp-content/themes/twentytwelve/functions.php	(working copy)
@@ -244,11 +244,11 @@
 	global $wp_query;
 
 	if ( $wp_query->max_num_pages > 1 ) : ?>
-		<nav id="<?php echo $nav_id; ?>" class="navigation" role="navigation">
+		<nav id="<?php echo sanitize_html_class( $nav_id ); ?>" class="navigation" role="navigation">
 			<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
 			<div class="nav-previous alignleft"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div>
 			<div class="nav-next alignright"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>
-		</nav><!-- #<?php echo $nav_id; ?> .navigation -->
+		</nav><!-- #<?php echo sanitize_html_class( $nav_id ); ?> .navigation -->
 	<?php endif;
 }
 endif;
